package jzqb.dao.impl;

import cnki.tpi.kbatis.sqlsession.SqlSession;
import cnki.tpi.kbatis.utils.DataSourceUtil;
import jzqb.bo.CollectClassifyBo;
import jzqb.dao.CollectClassifyDao;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 情报百科数据层实现类
 */
@Repository
public class CollectClassifyDaoImpl implements CollectClassifyDao {

    @Override
    public Boolean insertCollectClassify(CollectClassifyBo collectClassifyBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.insertCollectClassify";
        return sqlSession.executeInsert(statementId, collectClassifyBo);
    }

    @Override
    public Boolean updateCollectClassify(CollectClassifyBo collectClassifyBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.updateCollectClassify";
        return sqlSession.executeUpdate(statementId, collectClassifyBo);
    }

    @Override
    public Boolean deleteCollectClassify(CollectClassifyBo collectClassifyBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.deleteCollectClassify";
        return sqlSession.executeDelete(statementId, collectClassifyBo);
    }

    @Override
    public CollectClassifyBo getCollectClassifyByName(CollectClassifyBo collectClassifyBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.getCollectClassifyByName";
        return sqlSession.selectOne(statementId, collectClassifyBo, false);
    }

    @Override
    public List<CollectClassifyBo> getCollectClassifyList(String userId) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.getCollectClassifyList";
        return sqlSession.selectList(statementId, userId, false);
    }

    @Override
    public CollectClassifyBo getCollectById(String id) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.CollectClassifyDao.getCollectById";
        return sqlSession.selectOne(statementId, id, false);
    }
}
